package com.drakulo.games.ais.core.audio;

import org.newdawn.slick.Music;
import org.newdawn.slick.SlickException;

public final class MusicManager {
	private static final String BASE = "data/audio/music/";
	private static final String EXT = ".ogg";
	private static final MusicManager INSTANCE = new MusicManager();

	public static final String M1 = BASE + "M1";

	private String playingMusic;

	private MusicManager() {
		playingMusic = null;
	}

	public static MusicManager getInstance() {
		return INSTANCE;
	}

	public void playMusic(String key) {
		Music m;
		try {
			m = new Music(key + EXT, true);
			// m.setVolume(0.1F);
			m.loop();
			playingMusic = key;
		} catch (SlickException e) {
			System.out.println("Could not play sound : " + key + EXT);
			e.printStackTrace();
		}
	}

	public String getPlayingMusic() {
		return playingMusic;
	}
}
